<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box {
            
            position: fixed;
            right: 0;
            bottom: 0;
            overflow: hidden;
        }
        .box .top{
            width: 400px;
            height: 400px;
            background-color: red;
        }
        .box .bottom {
            width: 400px;
            height: 200px;
            background-color: green;
        }
        .close{
            position: absolute;
            right: 10px;
            top: 10px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="close">x</div>
        <div class="top"></div>
        <div class="bottom"></div>
    </div>
    <script src='../jquery-1.12.4.js'></script>
    <script>
        $(function(){
            $('.close').click(function(){
                $('.bottom').animate({height:0},1000,function(){
                    $('.box').animate({width:0},1000);
                })
            })
        })
    </script>

</body>
</html>